//
//  MVCircleListViewController.m
//  MVVMDemo
//
//  Created by ChenJs92 on 16/11/11.
//  Copyright © 2016年 chenjs92. All rights reserved.
//

#import "MVCircleListViewController.h"
#import "MVCircleListView.h"
#import "MVCircleListViewModel.h"
@interface MVCircleListViewController ()
@property (strong, nonatomic) MVCircleListView *mainView;
@property (strong, nonatomic) MVCircleListViewModel *viewModel;
@end

@implementation MVCircleListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)updateViewConstraints{
    WS(weakSelf)
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(weakSelf.view);
    }];
    [super updateViewConstraints];
}
-(void)yd_addSubviews{
    [self.view addSubview:self.mainView];
}
-(void)yd_bindViewModel{
    @weakify(self);
    [[self.viewModel.cellClickSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
        @strongify(self);
        ViewController *vc = [[ViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }];
}
-(void)yd_layoutNavigation{
    self.title = @"圈子列表";
}
-(MVCircleListView *)mainView{
    if (!_mainView) {
        _mainView = [[MVCircleListView alloc] initWithViewModel:self.viewModel];
    }
    return _mainView;
}
-(MVCircleListViewModel *)viewModel{
    if (!_viewModel) {
        _viewModel = [[MVCircleListViewModel alloc] init];
    }
    return _viewModel;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
